package com.hrsoft.edi.stub.internal;

import com.qimen.api.QimenRequest;
import com.taobao.api.ApiException;
import com.taobao.api.TaobaoParser;
import com.taobao.api.internal.mapping.Converter;

public class QimenXmlRequestParser<T extends QimenRequest> implements TaobaoParser<T>
{
    private Class<T> clazz;

    public QimenXmlRequestParser(Class<T> clazz) {
        this.clazz = clazz;
    }

    @Override
    public T parse(String req, String requestType)
        throws ApiException
    {
        Converter converter = new XmlConverter(requestType);
        return (T)converter.toResponse(req, this.clazz);
    }

    public Class<T> getResponseClass() {
        return this.clazz;
    }
}
